/**
 * 
 */
package co.fitstart.entity.reference;

import com.demo2do.core.utils.Alias;

/**
 * @author lute
 * @author leo
 *
 */
@Alias(value = "gender")
public enum Gender {

    MALE(1, "男", "male", "info", true),
    
    FEMALE(2, "女", "female", "success", true),

    UNKNOWN(3, "未知", "unknown", "default", false);
    
    private int code;
    
    private String description;
    
    private String alias;
    
    private String css;

    private boolean display;
    
    Gender(int code, String description, String alias, String css, boolean display) {
        this.code = code;
        this.description = description;
        this.alias = alias;
        this.css = css;
        this.display = display;
    }
    
    /**
     * 
     * @param code
     * @return
     */
    public static Gender codeOf(int code) {
       for(Gender sex : Gender.values()) {
           if(sex.getCode() == code) {
               return sex;
           }
       }
       return null;
    }
    
    public boolean isMale() {
       return this.equals(MALE);
    }
    
    /**
     * @return the code
     */
    public int getCode() {
        return this.code;
    }
    
    /**
     * 
     * @return
     */
    public String getDescription() {
        return description;
    }
    
    /**
     * 
     * @return
     */
    public String getAlias() {
        return alias;
    }
    
    /**
     * 
     * @return
     */
    public String getCss() {
        return css;
    }

    /**
     * 
     * @return
     */
    public boolean isDisplay() {
        return display;
    }
    
    /**
     * 
     * @return
     */
    public String getName() {
        return name();
    }

}
